package org.rsbot.event.events;

import java.awt.Color;
import java.awt.Composite;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.AffineTransform;
import java.util.EventListener;
import org.rsbot.event.listeners.TextPaintListener;

public class TextPaintEvent extends RSEvent
{
  private static final long serialVersionUID = 6634362568916377937L;
  public Graphics graphics;
  public int idx;

  public void dispatch(EventListener paramEventListener)
  {
    Graphics2D localGraphics2D = (Graphics2D)this.graphics;

    Color localColor1 = localGraphics2D.getBackground();
    Shape localShape = localGraphics2D.getClip();
    Color localColor2 = localGraphics2D.getColor();
    Composite localComposite = localGraphics2D.getComposite();
    Font localFont = localGraphics2D.getFont();
    Paint localPaint = localGraphics2D.getPaint();
    RenderingHints localRenderingHints = localGraphics2D.getRenderingHints();
    Stroke localStroke = localGraphics2D.getStroke();
    AffineTransform localAffineTransform = localGraphics2D.getTransform();

    this.idx = ((TextPaintListener)paramEventListener).drawLine(this.graphics, this.idx);

    localGraphics2D.setBackground(localColor1);
    localGraphics2D.setClip(localShape);
    localGraphics2D.setColor(localColor2);
    localGraphics2D.setComposite(localComposite);
    localGraphics2D.setFont(localFont);
    localGraphics2D.setPaint(localPaint);
    localGraphics2D.setRenderingHints(localRenderingHints);
    localGraphics2D.setStroke(localStroke);
    localGraphics2D.setTransform(localAffineTransform);
  }

  public long getMask()
  {
    return 8192L;
  }
}